<%-- 
    Document   : index
    Created on : 8 mars 2013, 11:38:31
    Author     : alocubiche
--%>
<%@page import="model.Item"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<jsp:useBean id="articles" class="java.util.ArrayList" scope="session" />
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Liste d'articles</title>
        <link rel="stylesheet" type="text/css" href="style.css" />
    </head>
    <body>
        <h1>Articles à vendre</h1>
        <hr />
        <h2><a href='index.jsp'>Accueil</a></h2>
            <form method="post" action="MainController">
                <table border="1" width="60%" align="center">
                    <tr>
                        <th>ID</th>
                        <th>Name</th>
                        <th>Price</th>
                        <th>Quantity</th>
                        <th>Buy ?</th>
                    </tr>
                    <% for(int i=0; i<articles.size();i++){
                        Item item = (Item)articles.get(i);
                    %>
                    <tr>
                            <td><%=item.getId()%></td>
                            <td><%=item.getName()%></td>
                            <td><%=item.getPrice()%></td>
                            <td><%=item.getQuantity()%></td>
                            <td>
                                <input type="hidden" name="id" value="<%=item.getId()%>" />
                                <input type="number" name='idQuantity' value ="0" max="<%=item.getQuantity()%>" min="0"/><p />
                            </td>
                    </tr>
                    <% } %>
                    <tr>
                        <td style="height:37px;" colspan="5"><input class="siteButton" type="submit" name="action" value="Buy"></td>
                    </tr>
                </table>
            </form>
                
                <form method="get" action="modifier.php">
    <p>
   </form>
    </body>
</html>